package xw.qxypt.modules.baseinfo.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import xw.qxypt.common.utils.PageUtils;
import xw.qxypt.common.utils.Query;

import xw.qxypt.modules.baseinfo.dao.LhpThresholdSettingDao;
import xw.qxypt.modules.baseinfo.entity.LhpThresholdSettingEntity;
import xw.qxypt.modules.baseinfo.service.LhpThresholdSettingService;


@Service("lhpThresholdSettingService")
public class LhpThresholdSettingServiceImpl extends ServiceImpl<LhpThresholdSettingDao, LhpThresholdSettingEntity> implements LhpThresholdSettingService {
    @Autowired
    LhpThresholdSettingDao lhpThresholdSettingDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<LhpThresholdSettingEntity> page = this.page(
                new Query<LhpThresholdSettingEntity>().getPage(params),
                new QueryWrapper<LhpThresholdSettingEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public LhpThresholdSettingEntity getInfo(String param) {
        String paramarray[]=param.split("-");
        LhpThresholdSettingEntity lhpThresholdSettingEntity=lhpThresholdSettingDao.getInfo(
                new QueryWrapper<LhpThresholdSettingEntity>()
                        .eq(StringUtils.isNotBlank(paramarray[0]),"equiment_id", paramarray[0])
                        .eq(StringUtils.isNotBlank(paramarray[1]),"level_id", paramarray[1])
        );
        return lhpThresholdSettingEntity;
    }

}
